{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'pd' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mNameError\u001B[0m                                 Traceback (most recent call last)",
      "\u001B[1;32m<ipython-input-1-649f39aa50ea>\u001B[0m in \u001B[0;36m<module>\u001B[1;34m\u001B[0m\n\u001B[1;32m----> 1\u001B[1;33m \u001B[0mdf\u001B[0m \u001B[1;33m=\u001B[0m \u001B[0mpd\u001B[0m\u001B[1;33m.\u001B[0m\u001B[0mread_csv\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34m'DataSet/TIMES.csv'\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m\u001B[0;32m      2\u001B[0m \u001B[0mdf\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m      3\u001B[0m \u001B[1;33m\u001B[0m\u001B[0m\n",
      "\u001B[1;31mNameError\u001B[0m: name 'pd' is not defined"
     ]
    }
   ],
   "source": [
    "df = pd.read_csv('DataSet/TIMES.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = df.loc[:,['University','Country','Number_students','Percentage_Male','Percentage_Female']]\n",
    "df = df.iloc[:60,:]\n",
    "# df = df.drop([36,46,50])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = []\n",
    "for x in df['Percentage_Male']:\n",
    "    x = float(x[:-1]) * 0.01\n",
    "    X.append(x)\n",
    "df['Percentage_Male'] = X\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = []\n",
    "for x in df['Percentage_Female']:\n",
    "    x = int(x[:-1]) * 0.01\n",
    "    X.append(x)\n",
    "df['Percentage_Female'] = X\n",
    "df\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = []\n",
    "for x in df.Number_students:\n",
    "    tmp = str(x).replace(',', '')\n",
    "    X.append(int(tmp))\n",
    "df['Number_students'] = X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = list(df.Number_students)\n",
    "Y = list(df.Percentage_Male)\n",
    "Y_1 = list(df.Percentage_Female)\n",
    "Z = []\n",
    "Z_1 = []\n",
    "for i in range(len(X)):\n",
    "    Male_Student = int(X[i] * Y[i])\n",
    "    Z.append(Male_Student)\n",
    "    Z_1.append(X[i] - Male_Student)\n",
    "Z\n",
    "df['Male_Student'] = Z\n",
    "df['Female_Student']= Z_1\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = df.loc[df['Percentage_Male']!=0]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = df.loc[:,['University','Country','Male_Student','Female_Student']]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = [i for i in df.Male_Student]\n",
    "Z = ['male' for i in range(len(X))]\n",
    "Y = [i for i in df.Female_Student]\n",
    "Z_1 = ['female' for i in range(len(Y))]\n",
    "X.extend(Y)\n",
    "Z.extend(Z_1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv(r'./DataSet/temp.txt', sep= '\\t')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot=pd.read_csv('./DataSet/temp.txt',delimiter= '\\t',index_col= False)\n",
    "plot "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "fig = plt.figure()\n",
    "sns.catplot(x = 'University', y = 'Number', hue = 'Gender', col = 'Country',data = plot, kind = 'bar')\n",
    "plt.savefig('./DataSet/Img.png', dpi = 400,bbox_inches='tight')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from neo4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-19T10:32:50.972324Z",
     "start_time": "2021-01-19T10:32:50.964345Z"
    }
   },
   "outputs": [],
   "source": [
    "# Keys = ['a','b','c']\n",
    "# Values= [1,1,2,3,4]\n",
    "# Dict = dict(zip(Keys,Values))\n",
    "# Dict.values()\n",
    "\n",
    "X = []\n",
    "Dict = {'a':1,'b':[2,3,4],'c':{2},'d':{2,3,4},'e':[2],'f':'123','g':{'a':1},'h':{'a':1,'b':2}}\n",
    "# Dict.update({'b':3})\n",
    "for key,value in Dict.items():\n",
    "    if type(value) is not int and type(value) is not str:\n",
    "            if len(value) != 1:\n",
    "                X.append(key)\n",
    "    \n",
    "#     if type(value) is not(int):\n",
    "#         X.append(key)\n",
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-01-19T14:49:06.875381Z",
     "start_time": "2021-01-19T14:49:06.856433Z"
    }
   },
   "outputs": [],
   "source": [
    "Dict = {'a':1,'b':2,'c':'1','d':'2'}\n",
    "Dict\n",
    "\n",
    "X = dict()\n",
    "for key,value in Dict.items():\n",
    "    if str(value) in X:\n",
    "        X[str(value)].append(key)\n",
    "    else:\n",
    "        X[str(value)] = []\n",
    "        X[str(value)].append(key)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-02-23T07:48:10.313223Z",
     "start_time": "2021-02-23T07:48:10.293224Z"
    }
   },
   "outputs": [],
   "source": [
    "import torch\n",
    "from torch import nn\n",
    "\n",
    "m = nn.Softmax(dim=1)\n",
    "m_input = torch.randn(2, 3)\n",
    "output = m(m_input)\n",
    "m_input = torch.randn(2, 3)\n",
    "m_input,output"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}